package com.mz.ozy.adapter;

import android.text.Html;
import android.text.Spanned;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mz.ozy.R;
import com.mz.ozy.bean.FamilyFeastBean;
import com.mz.ozy.bean.ShogBean;
import com.mz.ozy.utils.glideUtils.GlideUtils;

import java.util.List;

/**
 *
 */

public class PrivateCustomAdapter extends BaseQuickAdapter<FamilyFeastBean.FamilyListBean, BaseViewHolder> {

    public PrivateCustomAdapter(List<FamilyFeastBean.FamilyListBean> data) {
        super(R.layout.item_private_custom, data);
//        addData(new FamilyFeastBean.FamilyListBean());
//        addData(new FamilyFeastBean.FamilyListBean());
//        addData(new FamilyFeastBean.FamilyListBean());
//        addData(new FamilyFeastBean.FamilyListBean());
    }

    @Override
    protected void convert(BaseViewHolder helper, FamilyFeastBean.FamilyListBean item) {
        ImageView iv_image = helper.getView(R.id.iv_image);
        GlideUtils.loadRoundImg(mContext, iv_image, item.getImg(), R.mipmap.default_main_banner, 4);
        helper.setText(R.id.tv_title, item.getName());
        if (!TextUtils.isEmpty(item.getPaper())) {
            String regFormat = "\\s*|\t|\r|\n";
            String regTag = "<[^>]*>";
            String text = item.getPaper().replaceAll(regFormat, "").replaceAll(regTag, "");
            helper.setText(R.id.tv_desc1, text);
        } else {
            helper.setText(R.id.tv_desc1, "");
        }
        helper.setText(R.id.tv_price, "¥" + item.getPrice());
        helper.addOnClickListener(R.id.ll_item_view);
        helper.addOnClickListener(R.id.tv_order_home);
        helper.addOnClickListener(R.id.tv_online_order);
    }


}
